package com.chen.springbootjsp.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

@Controller
public class WelcomeController {

    @GetMapping("/")
    public ModelAndView welcome(){
        ModelAndView modelAndView = new ModelAndView();
        Calendar calendar = Calendar.getInstance();
        modelAndView.addObject("msg","helo jsp");
        modelAndView.addObject("time",calendar.get(Calendar.YEAR) + "-" +calendar.get(Calendar.MONTH) +"-" +calendar.get(Calendar.DATE));
        modelAndView.setViewName("welcome");
        return modelAndView;
    }
}
